package com.hq.fxh.No3_TuiGuang.Adaoter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


import com.hq.fxh.CustomerView.CircleImageView;
import com.hq.fxh.Modle.GetDayStatisticalResultRes;
import com.hq.fxh.R;
import com.hq.fxh.Utils.GlideUtils;

import java.util.List;


/**
 * @author 小谢
 * @ClassName BusiPromotionFragmentAdapter
 * @Description :
 * @Created 2016/12/29 0029
 */
public class ExportDetailFragmentAdapter extends RecyclerView.Adapter<ExportDetailFragmentAdapter.MyViewHolder> {

    private List<GetDayStatisticalResultRes.DataBean> mDatas;
    private Context mContext;
    private LayoutInflater inflater;

    public ExportDetailFragmentAdapter(Context context, List<GetDayStatisticalResultRes.DataBean> datas) {
        this.mContext = context;
        this.mDatas = datas;
        inflater = LayoutInflater.from(mContext);
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_stati_more_info, parent, false);
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        GetDayStatisticalResultRes.DataBean data = mDatas.get(position);

        holder.name.setText(data.getUser_nick_name());
        holder.num.setText(data.getValue()+"");
         GlideUtils.loadImageView(mContext,data.getUser_heder_url(),holder.head);
    }

    @Override
    public int getItemCount() {
        return mDatas != null ? mDatas.size() : 0;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView name, num;
        CircleImageView head;

        public MyViewHolder(View view) {
            super(view);
            name = (TextView) view.findViewById(R.id.more_info_name);
            num = (TextView) view.findViewById(R.id.more_info_num);
            head = (CircleImageView) view.findViewById(R.id.more_info_head);
        }
    }
}
